# -*- coding: utf-8 -*-
from utils.operators.spark_submit import SparkSubmitOperator
from jms.dm import jms_dm__cn_address_warehouse_day_rule_dt
# 20220902夏伯承写入ES兜底任务下线
jms_es__signed_address_paint_marker_ml = SparkSubmitOperator(
    task_id='jms_es__signed_address_paint_marker_ml',
    pool_slots=7,
    # depends_on_past=True,  # 如果任务依赖于前一天的同名任务，则将 depends_on_past 设为 True
    task_concurrency=1,  # 如果任务不支持并发，则将 task_concurrency 设为 1
    name='jms_es__signed_address_paint_marker_ml_{{ execution_date | cst_ds }}',  # yarn 任务名称
    driver_memory='4G',
    executor_memory='8G',
    executor_cores=5,
    num_executors=16,
    priority_weight=5,
    email=['yushuo@jtexpress.com','yl_bigdata@yl-scm.com'],
    conf={'spark.executor.memoryOverhead': 2048,
          'spark.core.connection.ack.wait.timeout': 3000,
          'spark.default.parallelism': 600,
          'spark.locality.wait': 60,
          'spark.driver.maxResultSize': 20,
          },
    java_class='com.yunlu.bigdata.jobs.ml.SignedAddress2esForML',  # spark 主类
    application='hdfs:///scheduler/jms/spark/lyx/ml/SignedAddress2esForML/jobs-1.0-SNAPSHOT-jar-with-dependencies.jar',  # spark jar 包
    # application='hdfs:///user/spark/work/dm/lyx/ExportEconomicCircleTimeAnalyse/jobs-1.0-SNAPSHOT-jar-with-dependencies.jar',  # spark jar 包
    application_args=['{{ execution_date | cst_ds }}'],  # 参数dt 2020-10-26
    # execution_timeout=max(datetime.now().replace(hour=7, minute=0, second=0) - datetime.now(), timedelta(seconds=1)),
    retries=0
)

jms_es__signed_address_paint_marker_ml << [jms_dm__cn_address_warehouse_day_rule_dt]
